<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <title>影视直播厅</title>

</head>
<body>
<h1 align="center">欢迎进入电影网站首页</h1>
<form sec:authorize="isAuthenticated()" th:action="@{/mylogout}" method="post">
    <input style="text-align: right" th:type="submit" th:value="注销">
</form>
    <hr/>
<div sec:authorize="isAnonymous()">
    <h2 align="center">游客您好如果想看电影<a th:href="@{/login}">请登录</a></h2>
</div>
<div sec:authorize="isAuthenticated()">
    <h2 align="center">
        <span sec:authentication="name" style="color: #007bff"></span>
        您好,您的用户权限为<span sec:authentication="principal.authorities" style="color: #b8daff"></span>
        您有权观看以下电影</h2>
</div>
<div th:each="mt:${movies}" sec:authorize="hasRole('common')">
    <h3 th:text="${mt.name}">电影类型</h3>
    <ul>
        <li th:each="mo:${mt.movieList}">
            <a th:text="${mo.name}" th:href="@{'/toMoviePage/'+${mt.type}+'/'+${mo.id}}"></a>
        </li>
    </ul>
</div>
</body>
</html>
